package com.taotao.rop.database.domain;

import java.util.List;

public class Menu extends Page {
    private Long id;
    private Long parentId;
    private String name;
    private Integer status;
    private Integer sort;
    private String url;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }



    private List<Menu> subMenus;
    public List<Menu> getSubMenus() {
        return subMenus;
    }

    public void setSubMenus(List<Menu> subMenus) {
        this.subMenus = subMenus;
    }

    public boolean haveRole(List<RoleMenu> roleMenuList) {
        boolean hasRole = false;
        for (RoleMenu roleMenu : roleMenuList) {
            if (roleMenu.getMenuId().equals(this.getId())) {
                hasRole = true;
                break;
            }
        }
        return hasRole;
    }
}
